package com.example.flshtarvel.mapper;

import com.example.flshtarvel.entity.History;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface HistoryMapper {
    //添加浏览记录
    @Insert("insert into history (message_id,message_name,user_id,article_type_id) values(#{messageId},#{messageName},#{userId},#{articleTypeId})")
    public int history(History history);

    //删除浏览记录  messageId
    @Delete("delete from history where message_id=#{messageId} and user_id=#{userId}")
    public int deleteHistory(String messageId,String userId);

    //查询浏览记录 根据用户id
    @Select("select * from history where history.user_id = #{userId} ")
    public List<History> selectHistoryByUserId(String userId);
}
